<template>
  <h2>我是About的内容</h2>
</template>
<script>
export default {
  name: "About",
  mounted() {
    console.log('about组件被使用', this)
  },
  beforeDestroy() {
    console.log('about组件被销毁')
  },
  //组件内路由守卫

  //通过路由进入该组件时被调用
  beforeRouteEnter(to, from, next) {
    console.log('通过路由规则进入了About组件')
    console.log(to, from)
    next()//进入该组件
  },
  //通过路由离开该组件时被调用
  beforeRouteLeave(to, from, next) {
    console.log('通过路由规则离开了About组件')
    console.log(to, from)
    next()//放行到下一个组件的路由地址

  }
}
</script>
<style scoped>

</style>